module.exports.EventTypes = keyMirror({
  SEND_MESSAGE: null,
  RECEIVED_MESSAGE: null,
  RECEIVED_NOTIFICATION: null,
  UPDATED_USER_INFO: null,
  UPDATED_SERVICES: null,
  OFFLINE: null,
  CONNECTION_STATUS_CHANGED: null
});

module.exports.StrategyTypes = keyMirror({
  ONLINE_RANDOM: null
});

module.exports.ServiceSwitchStage = keyMirror({
  SERVICE_SWITCH_REQUEST: null,       // 开始请求切换客服
  SERVICE_SWITCH_RECEIVED: null,      // 客户端接收到请求
  SERVICE_SWITCH_SUCCESS: null,        // 切换完毕
  SERVICE_SWITCH_RESET: null          //重置客服
});

module.exports.CommandTypes = keyMirror({
  SWITCH_SERVICE: null
});


module.exports.OnlineStatus = {
  ONLINE: 0,
  OFFLINE: 1,
  LOGOUT: 2
};

module.exports.ServiceType = {
  MAIN_SERVICE: 1,
  CUSTOMER_SERVICE: 2
};

function keyMirror(obj) {
  for (var key in obj) {
    if (obj.hasOwnProperty(key)) {
      if (typeof obj[key] === 'object' && obj[key]) {
        keyMirror(obj[key]);
      } else {
        obj[key] = key;
      }
    }
  }
  return obj;
}
